var SetDeptInCountType = function () {
  var template = /*html*/ `
    <div class="setDeptInCountTypeClass" v-loading.fullscreen.lock="loading">
      <el-form :model="deptList" label-width="200px">
        <template v-for="(dept,index) in deptList">
          <el-form-item :label="dept.deptName" style="margin-bottom:0">
            <el-radio v-model="dept.inWorkShopMode" :label="0">报工与领料入库</el-radio>
            <el-radio v-model="dept.inWorkShopMode" :label="1">领料入库</el-radio>
          </el-form-item>
        </template>
        <el-form-item>
          <el-button type="primary" @click="setDeptInCountType">保存</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </div>
    `;
  return {
    props: {
      deptList: {
        type: Array,
        required: true
      }
    },
    data: function () {
      return {
        loading: false
      }
    },
    methods: {
      //设置部门入库方式
      setDeptInCountType: function () {
        var postData = [];
        var deptList = this.deptList;
        for (var i = 0; i < deptList.length; i++) {
          var obj = {
            id: deptList[i].id,
            inWorkShopMode: deptList[i].inWorkShopMode
          }
          postData.push(obj);
        }
        this.loading = true;
        var self = this;
        ajaxRequest("company/setDeptInWorkShopMode", {
          "jsonArray": JSON.stringify(postData)
        }).then(function (res) {
          self.$alert(res, "信息");
          self.loading = false;
        }).catch(function () {
          self.loading = false;
        });
      },
      //取消
      cancel: function () {
        this.$emit("cancel");
      }
    },
    template: template
  }
}();